/**
 * Web Storage Cache
 * 配置浏览器本地存储的方式，可直接存储对象数组。
 * 用法：
 * import { useCache } from '@/hooks/useCache'
 * const { wsCache } = useCache()
 * console.log(wsCache.get('isDark'))
 */
import WebStorageCache from "web-storage-cache";

// storage: 'localStorage' | 'sessionStorage' | Storage
type CacheType = "sessionStorage" | "localStorage";

export const hookCache = <T = any>(type: CacheType = "sessionStorage") => {
    const wsCache: WebStorageCache = new WebStorageCache({
        storage: type,
    });

    // wsCache.

    return { wsCache };
};

